// $ANTLR 3.0.1 C:\\Documents and Settings\\t2ladmin\\My Documents\\Projects\\2008\\OS3\\SyncLib\\src\\ac\\jp\\u_tokyo\\SyncLib\\modParser\\Mod.g 2008-09-21 18:05:52

	package ac.jp.u_tokyo.SyncLib.modParser;
	import java.util.LinkedList;
	import java.util.List;
	import ac.jp.u_tokyo.SyncLib.*;
	import ac.jp.u_tokyo.SyncLib.dictionaries.*;





import org.antlr.runtime.*;
import java.util.Stack;
import java.util.List;
import java.util.ArrayList;

public class ModParser extends Parser {
    public static final String[] tokenNames = new String[] {
        "<invalid>", "<EOR>", "<DOWN>", "<UP>", "NULL", "NOMOD", "VOID", "TRUE", "FALSE", "DIGIT", "ULETTER", "LLETTER", "LETTER", "NUMBER", "NAME", "STRING", "WS", "','", "'{'", "'}'", "'->'", "'='", "'!'"
    };
    public static final int LLETTER=11;
    public static final int NAME=14;
    public static final int WS=16;
    public static final int ULETTER=10;
    public static final int LETTER=12;
    public static final int NULL=4;
    public static final int NUMBER=13;
    public static final int VOID=6;
    public static final int DIGIT=9;
    public static final int FALSE=8;
    public static final int EOF=-1;
    public static final int TRUE=7;
    public static final int NOMOD=5;
    public static final int STRING=15;

        public ModParser(TokenStream input) {
            super(input);
        }
        

    public String[] getTokenNames() { return tokenNames; }
    public String getGrammarFileName() { return "C:\\Documents and Settings\\t2ladmin\\My Documents\\Projects\\2008\\OS3\\SyncLib\\src\\ac\\jp\\u_tokyo\\SyncLib\\modParser\\Mod.g"; }

    
    	public static Mod[] parse(String text) throws RecognitionException {
    		ANTLRStringStream input = new ANTLRStringStream(text);
    		ModLexer lexer = new ModLexer(input);
    		ModParser parser = new ModParser(new CommonTokenStream(lexer));
    		return parser.prog().toArray(new Mod[] {});
    	}



    // $ANTLR start prog
    // C:\\Documents and Settings\\t2ladmin\\My Documents\\Projects\\2008\\OS3\\SyncLib\\src\\ac\\jp\\u_tokyo\\SyncLib\\modParser\\Mod.g:58:1: prog returns [List<Mod> result] : mods ;
    public final List<Mod> prog() throws RecognitionException {
        List<Mod> result = null;

        List<Mod> mods1 = null;


        try {
            // C:\\Documents and Settings\\t2ladmin\\My Documents\\Projects\\2008\\OS3\\SyncLib\\src\\ac\\jp\\u_tokyo\\SyncLib\\modParser\\Mod.g:59:2: ( mods )
            // C:\\Documents and Settings\\t2ladmin\\My Documents\\Projects\\2008\\OS3\\SyncLib\\src\\ac\\jp\\u_tokyo\\SyncLib\\modParser\\Mod.g:59:4: mods
            {
            pushFollow(FOLLOW_mods_in_prog242);
            mods1=mods();
            _fsp--;

            result = mods1; 

            }

        }
        
        finally {
        }
        return result;
    }
    // $ANTLR end prog


    // $ANTLR start mods
    // C:\\Documents and Settings\\t2ladmin\\My Documents\\Projects\\2008\\OS3\\SyncLib\\src\\ac\\jp\\u_tokyo\\SyncLib\\modParser\\Mod.g:61:1: mods returns [List<Mod> result] : m1= mod ( ',' m2= mod )* ;
    public final List<Mod> mods() throws RecognitionException {
        List<Mod> result = null;

        Mod m1 = null;

        Mod m2 = null;


        try {
            // C:\\Documents and Settings\\t2ladmin\\My Documents\\Projects\\2008\\OS3\\SyncLib\\src\\ac\\jp\\u_tokyo\\SyncLib\\modParser\\Mod.g:62:2: (m1= mod ( ',' m2= mod )* )
            // C:\\Documents and Settings\\t2ladmin\\My Documents\\Projects\\2008\\OS3\\SyncLib\\src\\ac\\jp\\u_tokyo\\SyncLib\\modParser\\Mod.g:62:4: m1= mod ( ',' m2= mod )*
            {
            result = new LinkedList();
            pushFollow(FOLLOW_mod_in_mods264);
            m1=mod();
            _fsp--;

            result.add(m1);
            // C:\\Documents and Settings\\t2ladmin\\My Documents\\Projects\\2008\\OS3\\SyncLib\\src\\ac\\jp\\u_tokyo\\SyncLib\\modParser\\Mod.g:64:2: ( ',' m2= mod )*
            loop1:
            do {
                int alt1=2;
                int LA1_0 = input.LA(1);

                if ( (LA1_0==17) ) {
                    alt1=1;
                }


                switch (alt1) {
            	case 1 :
            	    // C:\\Documents and Settings\\t2ladmin\\My Documents\\Projects\\2008\\OS3\\SyncLib\\src\\ac\\jp\\u_tokyo\\SyncLib\\modParser\\Mod.g:64:3: ',' m2= mod
            	    {
            	    match(input,17,FOLLOW_17_in_mods270); 
            	    pushFollow(FOLLOW_mod_in_mods274);
            	    m2=mod();
            	    _fsp--;

            	    result.add(m2);

            	    }
            	    break;

            	default :
            	    break loop1;
                }
            } while (true);


            }

        }
        
        finally {
        }
        return result;
    }
    // $ANTLR end mods


    // $ANTLR start mod
    // C:\\Documents and Settings\\t2ladmin\\My Documents\\Projects\\2008\\OS3\\SyncLib\\src\\ac\\jp\\u_tokyo\\SyncLib\\modParser\\Mod.g:65:1: mod returns [Mod result] : ( dictmod | primmod | nomod );
    public final Mod mod() throws RecognitionException {
        Mod result = null;

        Mod dictmod2 = null;

        Mod primmod3 = null;


        try {
            // C:\\Documents and Settings\\t2ladmin\\My Documents\\Projects\\2008\\OS3\\SyncLib\\src\\ac\\jp\\u_tokyo\\SyncLib\\modParser\\Mod.g:66:2: ( dictmod | primmod | nomod )
            int alt2=3;
            switch ( input.LA(1) ) {
            case 18:
                {
                alt2=1;
                }
                break;
            case NULL:
            case TRUE:
            case FALSE:
            case NUMBER:
            case NAME:
            case STRING:
            case 22:
                {
                alt2=2;
                }
                break;
            case NOMOD:
            case VOID:
                {
                alt2=3;
                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("65:1: mod returns [Mod result] : ( dictmod | primmod | nomod );", 2, 0, input);

                throw nvae;
            }

            switch (alt2) {
                case 1 :
                    // C:\\Documents and Settings\\t2ladmin\\My Documents\\Projects\\2008\\OS3\\SyncLib\\src\\ac\\jp\\u_tokyo\\SyncLib\\modParser\\Mod.g:66:4: dictmod
                    {
                    pushFollow(FOLLOW_dictmod_in_mod290);
                    dictmod2=dictmod();
                    _fsp--;

                    result = dictmod2;

                    }
                    break;
                case 2 :
                    // C:\\Documents and Settings\\t2ladmin\\My Documents\\Projects\\2008\\OS3\\SyncLib\\src\\ac\\jp\\u_tokyo\\SyncLib\\modParser\\Mod.g:67:4: primmod
                    {
                    pushFollow(FOLLOW_primmod_in_mod298);
                    primmod3=primmod();
                    _fsp--;

                    result = primmod3;

                    }
                    break;
                case 3 :
                    // C:\\Documents and Settings\\t2ladmin\\My Documents\\Projects\\2008\\OS3\\SyncLib\\src\\ac\\jp\\u_tokyo\\SyncLib\\modParser\\Mod.g:68:4: nomod
                    {
                    pushFollow(FOLLOW_nomod_in_mod305);
                    nomod();
                    _fsp--;

                    result = NullMod.INSTANCE;

                    }
                    break;

            }
        }
        
        finally {
        }
        return result;
    }
    // $ANTLR end mod


    // $ANTLR start dictmod
    // C:\\Documents and Settings\\t2ladmin\\My Documents\\Projects\\2008\\OS3\\SyncLib\\src\\ac\\jp\\u_tokyo\\SyncLib\\modParser\\Mod.g:69:1: dictmod returns [Mod result] : '{' (i1= dictmoditem )? ( ',' i2= dictmoditem )* '}' ;
    public final Mod dictmod() throws RecognitionException {
        Mod result = null;

        dictmoditem_return i1 = null;

        dictmoditem_return i2 = null;


        try {
            // C:\\Documents and Settings\\t2ladmin\\My Documents\\Projects\\2008\\OS3\\SyncLib\\src\\ac\\jp\\u_tokyo\\SyncLib\\modParser\\Mod.g:70:2: ( '{' (i1= dictmoditem )? ( ',' i2= dictmoditem )* '}' )
            // C:\\Documents and Settings\\t2ladmin\\My Documents\\Projects\\2008\\OS3\\SyncLib\\src\\ac\\jp\\u_tokyo\\SyncLib\\modParser\\Mod.g:70:4: '{' (i1= dictmoditem )? ( ',' i2= dictmoditem )* '}'
            {
            DictModFactory f = new DictModFactory();
            match(input,18,FOLLOW_18_in_dictmod323); 
            // C:\\Documents and Settings\\t2ladmin\\My Documents\\Projects\\2008\\OS3\\SyncLib\\src\\ac\\jp\\u_tokyo\\SyncLib\\modParser\\Mod.g:71:6: (i1= dictmoditem )?
            int alt3=2;
            int LA3_0 = input.LA(1);

            if ( (LA3_0==NULL||(LA3_0>=TRUE && LA3_0<=FALSE)||(LA3_0>=NUMBER && LA3_0<=STRING)) ) {
                alt3=1;
            }
            switch (alt3) {
                case 1 :
                    // C:\\Documents and Settings\\t2ladmin\\My Documents\\Projects\\2008\\OS3\\SyncLib\\src\\ac\\jp\\u_tokyo\\SyncLib\\modParser\\Mod.g:71:7: i1= dictmoditem
                    {
                    pushFollow(FOLLOW_dictmoditem_in_dictmod328);
                    i1=dictmoditem();
                    _fsp--;

                    f.addPut(i1.key, i1.mod);

                    }
                    break;

            }

            // C:\\Documents and Settings\\t2ladmin\\My Documents\\Projects\\2008\\OS3\\SyncLib\\src\\ac\\jp\\u_tokyo\\SyncLib\\modParser\\Mod.g:72:2: ( ',' i2= dictmoditem )*
            loop4:
            do {
                int alt4=2;
                int LA4_0 = input.LA(1);

                if ( (LA4_0==17) ) {
                    alt4=1;
                }


                switch (alt4) {
            	case 1 :
            	    // C:\\Documents and Settings\\t2ladmin\\My Documents\\Projects\\2008\\OS3\\SyncLib\\src\\ac\\jp\\u_tokyo\\SyncLib\\modParser\\Mod.g:72:3: ',' i2= dictmoditem
            	    {
            	    match(input,17,FOLLOW_17_in_dictmod337); 
            	    pushFollow(FOLLOW_dictmoditem_in_dictmod341);
            	    i2=dictmoditem();
            	    _fsp--;

            	    f.addPut(i2.key, i2.mod);

            	    }
            	    break;

            	default :
            	    break loop4;
                }
            } while (true);

            match(input,19,FOLLOW_19_in_dictmod348); 
            result = f.create();

            }

        }
        
        finally {
        }
        return result;
    }
    // $ANTLR end dictmod

    public static class dictmoditem_return extends ParserRuleReturnScope {
        public Object key;
        public Mod mod;
    };

    // $ANTLR start dictmoditem
    // C:\\Documents and Settings\\t2ladmin\\My Documents\\Projects\\2008\\OS3\\SyncLib\\src\\ac\\jp\\u_tokyo\\SyncLib\\modParser\\Mod.g:74:1: dictmoditem returns [Object key, Mod mod] : prim ( '->' | '=' ) m= mod ;
    public final dictmoditem_return dictmoditem() throws RecognitionException {
        dictmoditem_return retval = new dictmoditem_return();
        retval.start = input.LT(1);

        Mod m = null;

        Object prim4 = null;


        try {
            // C:\\Documents and Settings\\t2ladmin\\My Documents\\Projects\\2008\\OS3\\SyncLib\\src\\ac\\jp\\u_tokyo\\SyncLib\\modParser\\Mod.g:75:2: ( prim ( '->' | '=' ) m= mod )
            // C:\\Documents and Settings\\t2ladmin\\My Documents\\Projects\\2008\\OS3\\SyncLib\\src\\ac\\jp\\u_tokyo\\SyncLib\\modParser\\Mod.g:75:4: prim ( '->' | '=' ) m= mod
            {
            pushFollow(FOLLOW_prim_in_dictmoditem364);
            prim4=prim();
            _fsp--;

            retval.key = prim4;
            if ( (input.LA(1)>=20 && input.LA(1)<=21) ) {
                input.consume();
                errorRecovery=false;
            }
            else {
                MismatchedSetException mse =
                    new MismatchedSetException(null,input);
                recoverFromMismatchedSet(input,mse,FOLLOW_set_in_dictmoditem369);    throw mse;
            }

            pushFollow(FOLLOW_mod_in_dictmoditem380);
            m=mod();
            _fsp--;

            retval.mod = m;

            }

            retval.stop = input.LT(-1);

        }
        
        finally {
        }
        return retval;
    }
    // $ANTLR end dictmoditem


    // $ANTLR start primmod
    // C:\\Documents and Settings\\t2ladmin\\My Documents\\Projects\\2008\\OS3\\SyncLib\\src\\ac\\jp\\u_tokyo\\SyncLib\\modParser\\Mod.g:78:1: primmod returns [Mod result] : ( '!' )? prim ;
    public final Mod primmod() throws RecognitionException {
        Mod result = null;

        Object prim5 = null;


        try {
            // C:\\Documents and Settings\\t2ladmin\\My Documents\\Projects\\2008\\OS3\\SyncLib\\src\\ac\\jp\\u_tokyo\\SyncLib\\modParser\\Mod.g:79:3: ( ( '!' )? prim )
            // C:\\Documents and Settings\\t2ladmin\\My Documents\\Projects\\2008\\OS3\\SyncLib\\src\\ac\\jp\\u_tokyo\\SyncLib\\modParser\\Mod.g:79:5: ( '!' )? prim
            {
            // C:\\Documents and Settings\\t2ladmin\\My Documents\\Projects\\2008\\OS3\\SyncLib\\src\\ac\\jp\\u_tokyo\\SyncLib\\modParser\\Mod.g:79:5: ( '!' )?
            int alt5=2;
            int LA5_0 = input.LA(1);

            if ( (LA5_0==22) ) {
                alt5=1;
            }
            switch (alt5) {
                case 1 :
                    // C:\\Documents and Settings\\t2ladmin\\My Documents\\Projects\\2008\\OS3\\SyncLib\\src\\ac\\jp\\u_tokyo\\SyncLib\\modParser\\Mod.g:79:5: '!'
                    {
                    match(input,22,FOLLOW_22_in_primmod395); 

                    }
                    break;

            }

            pushFollow(FOLLOW_prim_in_primmod398);
            prim5=prim();
            _fsp--;

            result = new PrimMod(prim5);

            }

        }
        
        finally {
        }
        return result;
    }
    // $ANTLR end primmod


    // $ANTLR start prim
    // C:\\Documents and Settings\\t2ladmin\\My Documents\\Projects\\2008\\OS3\\SyncLib\\src\\ac\\jp\\u_tokyo\\SyncLib\\modParser\\Mod.g:80:1: prim returns [Object result] : ( NAME | STRING | NUMBER | NULL | TRUE | FALSE );
    public final Object prim() throws RecognitionException {
        Object result = null;

        Token NAME6=null;
        Token STRING7=null;
        Token NUMBER8=null;

        try {
            // C:\\Documents and Settings\\t2ladmin\\My Documents\\Projects\\2008\\OS3\\SyncLib\\src\\ac\\jp\\u_tokyo\\SyncLib\\modParser\\Mod.g:81:2: ( NAME | STRING | NUMBER | NULL | TRUE | FALSE )
            int alt6=6;
            switch ( input.LA(1) ) {
            case NAME:
                {
                alt6=1;
                }
                break;
            case STRING:
                {
                alt6=2;
                }
                break;
            case NUMBER:
                {
                alt6=3;
                }
                break;
            case NULL:
                {
                alt6=4;
                }
                break;
            case TRUE:
                {
                alt6=5;
                }
                break;
            case FALSE:
                {
                alt6=6;
                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("80:1: prim returns [Object result] : ( NAME | STRING | NUMBER | NULL | TRUE | FALSE );", 6, 0, input);

                throw nvae;
            }

            switch (alt6) {
                case 1 :
                    // C:\\Documents and Settings\\t2ladmin\\My Documents\\Projects\\2008\\OS3\\SyncLib\\src\\ac\\jp\\u_tokyo\\SyncLib\\modParser\\Mod.g:81:4: NAME
                    {
                    NAME6=(Token)input.LT(1);
                    match(input,NAME,FOLLOW_NAME_in_prim412); 
                    result = NAME6.getText();

                    }
                    break;
                case 2 :
                    // C:\\Documents and Settings\\t2ladmin\\My Documents\\Projects\\2008\\OS3\\SyncLib\\src\\ac\\jp\\u_tokyo\\SyncLib\\modParser\\Mod.g:82:4: STRING
                    {
                    STRING7=(Token)input.LT(1);
                    match(input,STRING,FOLLOW_STRING_in_prim420); 
                    result = STRING7.getText().substring(1, STRING7.getText().length() - 1);

                    }
                    break;
                case 3 :
                    // C:\\Documents and Settings\\t2ladmin\\My Documents\\Projects\\2008\\OS3\\SyncLib\\src\\ac\\jp\\u_tokyo\\SyncLib\\modParser\\Mod.g:83:4: NUMBER
                    {
                    NUMBER8=(Token)input.LT(1);
                    match(input,NUMBER,FOLLOW_NUMBER_in_prim427); 
                    result = new Integer(NUMBER8.getText());

                    }
                    break;
                case 4 :
                    // C:\\Documents and Settings\\t2ladmin\\My Documents\\Projects\\2008\\OS3\\SyncLib\\src\\ac\\jp\\u_tokyo\\SyncLib\\modParser\\Mod.g:84:4: NULL
                    {
                    match(input,NULL,FOLLOW_NULL_in_prim434); 
                    result = null;

                    }
                    break;
                case 5 :
                    // C:\\Documents and Settings\\t2ladmin\\My Documents\\Projects\\2008\\OS3\\SyncLib\\src\\ac\\jp\\u_tokyo\\SyncLib\\modParser\\Mod.g:85:4: TRUE
                    {
                    match(input,TRUE,FOLLOW_TRUE_in_prim441); 
                    result = true;

                    }
                    break;
                case 6 :
                    // C:\\Documents and Settings\\t2ladmin\\My Documents\\Projects\\2008\\OS3\\SyncLib\\src\\ac\\jp\\u_tokyo\\SyncLib\\modParser\\Mod.g:86:4: FALSE
                    {
                    match(input,FALSE,FOLLOW_FALSE_in_prim448); 
                    result = false;

                    }
                    break;

            }
        }
        
        finally {
        }
        return result;
    }
    // $ANTLR end prim


    // $ANTLR start nomod
    // C:\\Documents and Settings\\t2ladmin\\My Documents\\Projects\\2008\\OS3\\SyncLib\\src\\ac\\jp\\u_tokyo\\SyncLib\\modParser\\Mod.g:87:1: nomod : ( NOMOD | VOID );
    public final void nomod() throws RecognitionException {
        try {
            // C:\\Documents and Settings\\t2ladmin\\My Documents\\Projects\\2008\\OS3\\SyncLib\\src\\ac\\jp\\u_tokyo\\SyncLib\\modParser\\Mod.g:87:7: ( NOMOD | VOID )
            // C:\\Documents and Settings\\t2ladmin\\My Documents\\Projects\\2008\\OS3\\SyncLib\\src\\ac\\jp\\u_tokyo\\SyncLib\\modParser\\Mod.g:
            {
            if ( (input.LA(1)>=NOMOD && input.LA(1)<=VOID) ) {
                input.consume();
                errorRecovery=false;
            }
            else {
                MismatchedSetException mse =
                    new MismatchedSetException(null,input);
                recoverFromMismatchedSet(input,mse,FOLLOW_set_in_nomod0);    throw mse;
            }


            }

        }
        
        finally {
        }
        return ;
    }
    // $ANTLR end nomod


 

    public static final BitSet FOLLOW_mods_in_prog242 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_mod_in_mods264 = new BitSet(new long[]{0x0000000000020002L});
    public static final BitSet FOLLOW_17_in_mods270 = new BitSet(new long[]{0x000000000044E1F0L});
    public static final BitSet FOLLOW_mod_in_mods274 = new BitSet(new long[]{0x0000000000020002L});
    public static final BitSet FOLLOW_dictmod_in_mod290 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_primmod_in_mod298 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_nomod_in_mod305 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_18_in_dictmod323 = new BitSet(new long[]{0x00000000000AE190L});
    public static final BitSet FOLLOW_dictmoditem_in_dictmod328 = new BitSet(new long[]{0x00000000000A0000L});
    public static final BitSet FOLLOW_17_in_dictmod337 = new BitSet(new long[]{0x000000000000E190L});
    public static final BitSet FOLLOW_dictmoditem_in_dictmod341 = new BitSet(new long[]{0x00000000000A0000L});
    public static final BitSet FOLLOW_19_in_dictmod348 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_prim_in_dictmoditem364 = new BitSet(new long[]{0x0000000000300000L});
    public static final BitSet FOLLOW_set_in_dictmoditem369 = new BitSet(new long[]{0x000000000044E1F0L});
    public static final BitSet FOLLOW_mod_in_dictmoditem380 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_22_in_primmod395 = new BitSet(new long[]{0x000000000000E190L});
    public static final BitSet FOLLOW_prim_in_primmod398 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_NAME_in_prim412 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_STRING_in_prim420 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_NUMBER_in_prim427 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_NULL_in_prim434 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_TRUE_in_prim441 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_FALSE_in_prim448 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_set_in_nomod0 = new BitSet(new long[]{0x0000000000000002L});

}